const cloud = require('wx-server-sdk');

cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
});
const db = cloud.database();

// 修改数据库信息云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext();

  try { 
      // 读取自己发起的表单
      return await db.collection('bill').where({
        sqr_openid: wxContext.OPENID
      }).get()
    
  } catch (e) { 
    return {
      success: false,
      errMsg: e
    };
  }
};
